<html><head><title>WriteCGIHeader</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">WriteCGIHeader()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>WriteCGIHeader</b></font>(Header$, Value$ [, Flags])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Writes a header to the CGI output. The headers needs to be written before 
any other data. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>Header$</i></td>
<td width="90%"> 
The header to write. It can be a custom or one of the following value: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_CGI_HeaderContentLength</font> : the length (in bytes) of the output stream (implies binary data).
  <font color="#924B72">#PB_CGI_HeaderContentType</font>   : the MIME content type of the output stream.
  <font color="#924B72">#PB_CGI_HeaderExpires</font>       : date and time when the document is no longer valid 
                                and should be reloaded by the browser.
  <font color="#924B72">#PB_CGI_HeaderLocation</font>      : server redirection (cannot be sent as part of a complete header).
  <font color="#924B72">#PB_CGI_HeaderPragma</font>        : turns document caching on and off.
  <font color="#924B72">#PB_CGI_HeaderStatus</font>        : status of the request (cannot be sent as part of a complete header).
  <font color="#924B72">#PB_CGI_HeaderContentDisposition</font> : allows to specify a default filename when sending out a file.
  <font color="#924B72">#PB_CGI_HeaderRefresh</font>       : client reloads specified document.
  <font color="#924B72">#PB_CGI_HeaderSetCookie</font>     : client stores specified data, 
                                useful for keeping track of data between requests.
</font></pre>

</td></tr>
<tr><td><i>Value$</i></td>
<td> 
The header value to write. 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
The string encoding to use. It can be one of the following value: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Ascii</font> (default)
  <font color="#924B72">#PB_UTF8</font> 
</font></pre>
Combined with one of the following value: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_CGI_LastHeader</font> : This is the last header written, meaning no more headers can be sent. 
                       This flag is mandatory for the last header written.
</font></pre>

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns non-zero if the header has been successfully written to the CGI output. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <b><font color="#3A3966">Not</font></b> <font color="#3A3966">InitCGI</font>() <b><font color="#3A3966">Or</font></b> <b><font color="#3A3966">Not</font></b> <font color="#3A3966">ReadCGI</font>()
    <b><font color="#3A3966">End</font></b>
  <b><font color="#3A3966">EndIf</font></b>
  
<font color="#3A3966">  WriteCGIHeader</font>(<font color="#924B72">#PB_CGI_HeaderContentType</font>, &quot;text/html&quot;, <font color="#924B72">#PB_CGI_LastHeader</font>)
  
<font color="#3A3966">  WriteCGIString</font>(&quot;&lt;html&gt;&lt;title&gt;PureBasic - test&lt;/title&gt;&lt;body&gt;&quot; +
                 &quot;Hello from PureBasic CGI&lt;br&gt;&quot; +
                 &quot;&lt;/body&gt;&lt;/html&gt;&quot;)
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="initcgi.html">InitCGI()</a>, <a href="writecgifile.html">WriteCGIFile()</a>, <a href="writecgistringn.html">WriteCGIStringN()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=writecgifile.html>WriteCGIFile()</a> - <a href="index.html">CGI Index</a> - <a href="writecgistring.html">WriteCGIString()</a> -><br><br>

</body></html>